]> dgit.raspbian.org Git - gnome-shell.git/commit
popupMenu: Queue relayout on popup menu parent when opening
authorJonas Ådahl <jadahl@gmail.com>
Fri, 5 Sep 2025 13:53:52 +0000 (15:53 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Sat, 13 Sep 2025 17:03:25 +0000 (19:03 +0200)
commit1db4429d1b9e215c51df04ebd2bc5ebf36d45139
tree15e76f8dafbe49387e92ea779a77d68084a7858f
parentf78c9526437227d790137c8c0db57e814bbf4ad2
popupMenu: Queue relayout on popup menu parent when opening

The position of the menu depends on the position of the "source actor",
but the source actor is not a parent of the menu, but typically a
sibling.

Since we depend on the source actor position for placing the popup menu,
it's important that the source actor gets allocated before we allocate.
Currently the only way to ensure that the source actor is allocated
before the popup menu is by handling the layout via the parent actor, as
the order of the allocations done when queuing shallow relayouts is
currently undefined. As of d94638acae ("clutter/actor: Make child
position changes a noop when possible") in mutter,
Clutter.Actor.set_child_above_sibling() has a fast path when the
position doesn't change, which means the parent was did not get its
relayout queued. This caused the popup menu to end up being allocated
before the source actor, thus using an out of date source actor
allocation to base its position calculation on.

To fix this, queue a relayout on the parent actor unconditionally, after
inserting it into the parent actor, to let us be able to rely on the
source actor having been allocated before the popup menu itself getting
allocated.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/4253
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3863>
(cherry picked from commit ca198804598daf595d56600b76b0a0fd088252ee)
js/ui/popupMenu.js